import {posts} from '../assets/server/https'
import {get, post} from '../assets/server/http'

export * from './survey'
export * from './tenant'
export * from './article'

// 添加微网站点
export function addSite (query) {
  let url = `${process.env.VUE_APP_SERVICE_SITE}/manage/add`
  return posts(url, query)
}

// 查询微网站基本信息 siteId
export function getSiteBaseInfo (query) {
  let url = `${process.env.VUE_APP_SERVICE_SITE}/manage/baseInfo`
  return get(url, query)
}

// 查询微网站导航(不包含首页信息) siteId
export function getSiteNavInfo (query) {
  let url = `${process.env.VUE_APP_SERVICE_SITE}/manage/select_navigation`
  return get(url, query)
}

// 修改站点基本信息
export function updateSiteBaseInfo (query) {
  let url = `${process.env.VUE_APP_SERVICE_SITE}/manage/update`
  return posts(url, query)
}

// 修改站点导航信息
export function updateSiteNavInfo (query) {
  let url = `${process.env.VUE_APP_SERVICE_SITE}/manage/updateNav`
  return posts(url, query)
}

// 查询租户额外限制
export function getTanentLimit (query) {
  let url = `/org/limit`
  return get(url, query)
}

// 修改oss配置
export function UpdateOssConfig (query) {
  let url = `/oss/config/update`
  return post(url, query)
}

// 添加OSS配置
export function addOssConfig (query) {
  let url = `/oss/config/add`
  return post(url, query)
}

// 租户管理-获取(当前)租户所有信息
export function tenantManagerGetInfo (query) {
  let url = `/org/info`
  return get(url, query)
}

// 租户管理-修改租户(基本)信息
export function tenantManagerOrgModify (query) {
  let url = `/org/info`
  return posts(url, query)
}

// 直播信息
export function getLiveInfo (query) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/live/manage/activity/${query.liveId}`
  return get(url, query)
}

// 查询有留言的文章
export function getMessageArticles (params) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/message/knowledges`
  return get(url, params)
}

// 审批留言通过
export function approvalMessage (params) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/message/${params.knowledgeId}/${params.msgId}/audit`
  delete params.knowledgeId
  delete params.msgId
  return post(url, params)
}

// 取消留言精选
// export function cancelChoice (params) {
//   let url = `/knowledge/manage/article/message/cancelChoice`
//   return post(url, params)
// }

// 查询文章留言
export function getMessageList (params) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/message/knowledges/${params.knowledgeId}`
  delete params.knowledgeId
  return get(url, params)
}

// // 拒绝留言通过审核
// export function refuseMessage (param) {
//   let url = `/knowledge/message/article/message/refused`
//   return post(url, param)
// }

// 回复留言
export function replayMessage (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/message/${param.knowledgeId}/${param.msgId}/reply`
  delete param.knowledgeId
  delete param.msgId
  return post(url, param)
}

// 设置精选
export function setReplay (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/message/${param.knowledgeId}/${param.msgId}/selected`
  delete param.knowledgeId
  delete param.msgId
  return post(url, param)
}

// 管理端删除留言
export function deleteReplay (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/message/del/${param.knowledgeId}/${param.msgId}`
  return post(url)
}

// 查询用户反馈/提问列表
export function getFeedBackList (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/suggestion/list`
  return get(url, param)
}

// 建议标记已读
export function markAdviceReaded (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/suggestion/read`
  return post(url, param)
}

// 回复用户反馈
export function replyAdvice (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/suggestion/reply`
  return post(url, param)
}

// 管理端获取所有互动过的用户
export function getuserList (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/im/userList`
  return get(url, param)
}

// 管理端获取消息组下所有消息
export function getMsgList (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/im/msgList`
  return get(url, param)
}

// 管理端发送消息至消息组
export function pushMsg (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/im/push`
  return post(url, param)
}

// 管理端创建对话连接
export function imConnect (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/im/connect`
  return post(url, param)
}

// 管理端断开对话连接
export function breakConnect (param) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/im/breakConnect`
  return post(url, param)
}

// 新建客服群发
export function createKFGrupMessage (param) {
  let url = `${process.env.VUE_APP_SERVICE_WECHAT}/mass/message/${param.appid}/kf/create`
  delete param.appid
  return post(url, param)
}

// 新建模板群发
export function createTemplateMessage (param) {
  let url = `${process.env.VUE_APP_SERVICE_WECHAT}/mass/message/template`
  return post(url, param)
}

// 获取公众号消息模板列表
export function getTemplateList (param) {
  let url = `${process.env.VUE_APP_SERVICE_WECHAT}/mass/message/${param.appid}/templateList`
  delete param.appid
  return get(url, param)
}

// 导出粉丝
export function exportFans (param) {
  let url = `${process.env.VUE_APP_SERVICE_WECHAT}fans/download`
  return get(url, param, {responseType: 'blob'})
}

// 下载公开课报名流水excel
export function downloadClassApplyRecord (param, config) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/publicClass/manage/download/applyRecord`
  return post(url, param, config)
}

// 下载公开课观看流水excel
export function downloadClassWatchRecord (param, config) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/publicClass/manage/download/watchRecord`
  return post(url, param, config)
}

// 下载直播观看流水excel
export function downloadLiveWatchRecord (param, config) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/live/manage/download/watchRecord`
  return post(url, param, config)
}

// 下载直播报名流水excel
export function downloadLiveApplyRecord (param, config) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/live/manage/download/applyRecord`
  return post(url, param, config)
}

// 获取公开课报名流水
export function getClassApplyRecord (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/publicClass/manage/applyRecords`
  return get(url, param)
}

// 获取直播报名流水
export function getLiveApplyRecord (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/live/manage/applyRecords`
  return get(url, param)
}

// 获取公开课观看流水
export function getClassWatchRecord (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/publicClass/manage/watchRecords`
  return get(url, param)
}

// 获取直播观看流水
export function getLiveWatchRecord (param) {
  let url = `${process.env.VUE_APP_SERVICE_KNOWLEDGE}/live/manage/watchRecords`
  return get(url, param)
}

// 下载公司员工excel
export function downloadStaffexcel (param, config) {
  let url = `${process.env.VUE_APP_SERVICE_ORG}/emp/download/excel`
  return post(url, param, config)
}

// 查询oss信息
export function getOssInfo (param) {
  let url = `/org/config/oss`
  return get(url, param)
}
